const sequelize = require('../config/database');

// 导入所有模型
const User = require('./User');
const Pet = require('./Pet');
const Task = require('./Task');
const UserTask = require('./UserTask');

// 建立模型关联
const models = {
  User,
  Pet,
  Task,
  UserTask
};

// 调用每个模型的 associate 方法
Object.keys(models).forEach(modelName => {
  if (models[modelName].associate) {
    models[modelName].associate(models);
  }
});

module.exports = {
  sequelize,
  ...models
}; 